import Axios from '@/util/ajax'

const state = {


};

// 通过 mutation 去更改 state 里面的值
const mutations = {

};

// 通过 action 去 commit mutation
const actions = {
    async searchRole({state}, criteria){
        console.log("this.currentPage: ", criteria.pageNo);
        return await Axios.post('/aa/role/list', {
            pageSize: this.$store.state.pageSize,
            pageNo: criteria.pageNo,
            roleName: criteria.roleName
        });
    },

    async findUser2Role({state}, roleId){
        console.log("roleId: " + roleId);
        let res = await Axios.get('/aa/auth/gotoAddUser2Role/' + roleId);
        state.assignedUsers = res.result.assignedUsers;
        state.unassignedUsers = res.result.unassignedUsers;
    }
};

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
